package ooday02;

/* 子类，继承父类Person */
/* 学生类 */

//extends person : extends表示继承 person这个类

public class Student extends Person{
    String className;
    String stuId;

    //无参构造
    Student(){

    }
    //有参构造
    //继承父类的属性
                                    //属性中间用英文的逗号隔开
    Student(String name,int age,String address,String className,String stuId){
        this.name=name;
        this.age=age;
        this.address=address;
        this.className=className;
        this.stuId=stuId;
    }

    public void study()
    {
        System.out.println(name+"正在学习...");
    }

    //方法的重写
    void sayHi(){
        System.out.println("大家好，我叫"+name+"，今年"+age+"岁了，家住"+address+
                "，班级为:"+className+"，学号是:"+stuId);
    }
}
